﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace crm_data
{
    /// <summary>
    /// 客户基本信息
    /// </summary>
    [Table("basics_customer")]
    public class Customer : Entity
    {
        #region Model 实体属性

        /// <summary>
        /// 客户姓名
        /// </summary>
        [Required]
        [Display(Name = "客户姓名")]
        public string RealName { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Required]
        [Display(Name = "性别")]
        public SexEnum Sex { get; set; } = 0;

        /// <summary>
        /// 出生日期
        /// </summary>
        [Required]
        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        [Display(Name = "出生日期")]
        public DateTime Birthday { get; set; }

        /// <summary>
        /// 手机号码
        /// </summary>
        [Required]
        [StringLength(11)]
        [Display(Name = "手机号码")]
        public string PhoneNumber { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        [StringLength(11)]
        [Display(Name = "联系电话")]
        public string ContactNumber { get; set; }

        /// <summary>
        /// 客户状态
        /// </summary>
        [Required]
        [Display(Name = "状态")]
        public CustomerStateEnum CutomerState { get; set; } = 0;

        /// <summary>
        /// 是否删除
        /// </summary>
        [Required]
        [Display(Name = "是否删除")]
        public Boolean DelFlag { get; set; } = false;

        /// <summary>
        /// 创建时间
        /// </summary>
        [Required]
        [DataType(DataType.Date)]
        [Display(Name = "创建时间")]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 修改时间
        /// </summary>
        [DataType(DataType.Date)]
        [Display(Name = "修改时间")]
        public DateTime? UpdateTime { get; set; } = DateTime.Now;

        #endregion Model 实体属性

        /// <summary>
        /// 地址集合
        /// </summary>
        public virtual ICollection<CustomerAddress> Address { get; set; }
    }
}
